<?php

namespace common\entities\myhtsq;

use Yii;

/**
 * This is the model class for table "myscrm_erp_user".
 *
 * @property string $UserGUID
 * @property string $UserCode
 * @property string $UserName
 * @property string $BUGUID
 * @property string $PhotoUrl
 * @property string $JobTitle
 * @property string $Email
 * @property string $OfficePhone
 * @property string $MobilePhone
 * @property string $HomePhone
 * @property string $ADAccount
 * @property string $CreatedOn
 * @property string $ModifiedOn
 * @property string $CreatedBy
 * @property string $ModifiedBy
 * @property boolean $IsDisabeld
 * @property string $DisabledReason
 * @property string $Comments
 * @property string $ParentGUID
 * @property string $Password
 * @property boolean $IsAdmin
 * @property boolean $IsSaler
 * @property string $JobNumber
 * @property string $DepartmentGUID
 * @property string $UserProject
 * @property boolean $IsAdvanceUser
 * @property string $DefaultStation
 * @property integer $UserKind
 * @property string $JoinDate
 * @property string $CheckUserCode
 * @property string $keySN
 * @property string $lzDate
 * @property string $RegularizedDate
 * @property integer $HjCount
 * @property string $DeviceID
 * @property string $DeviceID2
 * @property double $StockRate
 * @property string $tuid
 * @property string $Zyx
 * @property string $PSWModifyTime
 * @property integer $IsUserChangePWD
 * @property integer $IsLocked
 * @property integer $IsMobileUser
 * @property string $LockTime
 * @property integer $UserNum
 * @property string $AbuName
 * @property string $AbuFzrName
 * @property string $DeptmentFzrName
 * @property string $AbuGUID
 * @property string $ABuFzrID
 * @property string $DeptmentFzrID
 */
class ErpUserEntity extends \common\entities\ConfigEntity
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_erp_user';
    }

    public static function globalTableName()
    {
        preg_match("/dbname=([^;]+)/i", self::getDb()->dsn, $matches);
        return $matches[1].'.myscrm_erp_user';
    }


    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['UserGUID', 'UserKind', 'DeviceID', 'DeviceID2', 'UserNum'], 'required'],
            [['CreatedOn', 'JoinDate', 'lzDate', 'RegularizedDate', 'PSWModifyTime', 'LockTime'], 'safe'],
            [['IsDisabeld', 'IsAdmin', 'IsSaler', 'IsAdvanceUser'], 'boolean'],
            [['UserKind', 'HjCount', 'IsUserChangePWD', 'IsLocked', 'IsMobileUser', 'UserNum'], 'integer'],
            [['StockRate'], 'number'],
            [['UserGUID', 'UserName', 'BUGUID', 'PhotoUrl', 'JobTitle', 'Email', 'ADAccount', 'ModifiedOn', 'CreatedBy', 'ModifiedBy', 'ParentGUID', 'Password', 'JobNumber', 'DepartmentGUID', 'DefaultStation', 'keySN', 'DeviceID', 'DeviceID2', 'Zyx'], 'string', 'max' => 50],
            [['UserCode', 'UserProject'], 'string', 'max' => 16],
            [['OfficePhone', 'MobilePhone', 'HomePhone', 'CheckUserCode'], 'string', 'max' => 20],
            [['DisabledReason', 'Comments'], 'string', 'max' => 200],
            [['tuid'], 'string', 'max' => 10]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'UserGUID' => 'User Guid',
            'UserCode' => 'User Code',
            'UserName' => 'User Name',
            'BUGUID' => 'Buguid',
            'PhotoUrl' => 'Photo Url',
            'JobTitle' => 'Job Title',
            'Email' => 'Email',
            'OfficePhone' => 'Office Phone',
            'MobilePhone' => 'Mobile Phone',
            'HomePhone' => 'Home Phone',
            'ADAccount' => 'Adaccount',
            'CreatedOn' => 'Created On',
            'ModifiedOn' => 'Modified On',
            'CreatedBy' => 'Created By',
            'ModifiedBy' => 'Modified By',
            'IsDisabeld' => 'Is Disabeld',
            'DisabledReason' => 'Disabled Reason',
            'Comments' => 'Comments',
            'ParentGUID' => 'Parent Guid',
            'Password' => 'Password',
            'IsAdmin' => 'Is Admin',
            'IsSaler' => 'Is Saler',
            'JobNumber' => 'Job Number',
            'DepartmentGUID' => 'Department Guid',
            'UserProject' => 'User Project',
            'IsAdvanceUser' => 'Is Advance User',
            'DefaultStation' => 'Default Station',
            'UserKind' => 'User Kind',
            'JoinDate' => 'Join Date',
            'CheckUserCode' => 'Check User Code',
            'keySN' => 'Key Sn',
            'lzDate' => 'Lz Date',
            'RegularizedDate' => 'Regularized Date',
            'HjCount' => 'Hj Count',
            'DeviceID' => 'Device ID',
            'DeviceID2' => 'Device Id2',
            'StockRate' => 'Stock Rate',
            'tuid' => 'Tuid',
            'Zyx' => 'Zyx',
            'PSWModifyTime' => 'Pswmodify Time',
            'IsUserChangePWD' => 'Is User Change Pwd',
            'IsLocked' => 'Is Locked',
            'IsMobileUser' => 'Is Mobile User',
            'LockTime' => 'Lock Time',
            'UserNum' => 'User Num',
        ];
    }
}
